package com.huqing.icu.enums;

import lombok.Getter;

/**
 * 社区帖子的排序类型枚举
 *
 * @author huqing
 * @date 2025-07-08 20:42:49
 */
@Getter
public enum PostSortTypeEnum {

    ID_DESC(10, "id倒序"),

    ID_ASC(11, "id升序"),

    ACTUAL_VIEW_NUM_DESC(20, "真实浏览量倒序"),

    ACTUAL_VIEW_NUM_ASC(21, "真实浏览量升序"),

    ;

    private Integer code;

    private String msg;

    PostSortTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static PostSortTypeEnum of(int code) {
        for (PostSortTypeEnum ostSortTypeEnum : values()) {
            if (ostSortTypeEnum.code.equals(code)) {
                return ostSortTypeEnum;
            }
        }
        return null;
    }
}
